package com.gmadmin.configuration.datasource;

import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;

import javax.sql.DataSource;

/**
 * {@code @Author}: zhang liang
 * {@code @Date}: 2022/10/1 13:27
 * {@code @BelongsProject}: gm
 * {@code @BelongsPackage}: com.gmadmin.configuration.datasource
 * {@code @Description}: 默认数据源配置
 */
@Configuration(proxyBeanMethods = false)
public class DefaultDataSourceConfig {
    /**
     * @Primary ：默认数据源
     */
    @Bean
    @Primary
    @ConfigurationProperties(prefix = "spring.datasource.primary")
    public DataSource defaultDataSource() {
        return DataSourceBuilder.create().build();
    }

}
